package demo.flow.impl;

import demo.flow.ProcessService;
import lombok.extern.slf4j.Slf4j;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.repository.Deployment;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class ProcessServiceImpl implements ProcessService {

    @Resource
    private ProcessEngine processEngine;
    final String leaveProcessName="请假流程1.0";
    final String leaveProcessPath="flows/leave.bpmn";
    /**
     * 部署请假流程
     */
    @Override
    public void deployLeaveProcess() {
        log.info("【请假流程】部署开始");
      Deployment deployment= processEngine.getRepositoryService().createDeployment().name(leaveProcessName).addClasspathResource(leaveProcessPath).deploy();

        log.info("【请假流程】部署完成");
    }
}
